﻿using System;
using System.Configuration;
using System.Web.Mvc;
using Zinnia.Demo.Filter;

namespace Zinnia.Demo
{
    public class FilterConfig
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            var isCustomHandleError = ConfigurationManager.AppSettings["IsCustomHandleError"];
            if (string.Equals("true", isCustomHandleError, StringComparison.OrdinalIgnoreCase))
            {
                filters.Add(new ExceptionFilter());
            }
            else
            {
                filters.Add(new HandleErrorAttribute());
            }

        }
    }
}